﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;

namespace ScannerNS.Classes
{
    public class FileReader
    {

        public string text;

        public string readFile(string fileName)
        {
            try
            {
                using (StreamReader sr = new StreamReader(fileName))
                {
                    char nextChar;

                    while (sr.Peek() != -1)
                    {
                        nextChar = (char)sr.Read();
                        text += nextChar; 
                    }

                    Console.WriteLine(text);
                    return text;
                }
            }
            catch (Exception)
            {
                Console.WriteLine("No file");
                throw;
            }
        }

    }
}
